<?php
$bp_ada = data_tersedia('t_bp',KD_PERKARA);
$pecah_bp = mysql_num_rows(mysql_query("SELECT * FROM t_bp WHERE kd_perkara LIKE '".KD_PERKARA."%'"));

if($bp_ada) {
	$dt_bp = mysql_fetch_array(mysql_query("
	SELECT * FROM t_bp WHERE kd_perkara='".KD_PERKARA."'
	"));

	$no_bp = $dt_bp['no_surat'];
	$tgl_dikeluarkan = konversi_tanggal('d-m-Y',$dt_bp['tgl_dikeluarkan']);
	$tgl_diterima = konversi_tanggal('d-m-Y',$dt_bp['tgl_diterima']);
} else {
	$no_bp = "";
	$tgl_dikeluarkan = "";
	$tgl_diterima = "";
}

//if($pecah_bp == 2) {
?>
<div class="da-panel-toolbar">
	<div class="btn-toolbar">
		<div class="btn-group">
		
			<a href="#" class="btn">Berkas perkara 1</a>
		</div>
	</div>
</div>
<?php //} ?>
<table class="da-table da-detail-view no-border">
	<tbody>
		<tr>
			<th>Nomor Polisi</th>
			<td><?php echo $dt_spdp['no_polisi'].$pecah_bp ?></td>
		</tr>
		<tr>
			<th>Tanggal Penyidikan</th>
			<td><?php echo konversi_tanggal('d-m-Y',$dt_spdp['tgl_penyidikan'])?></td>
		</tr>
		<tr>
			<th>Penyidik</th>
			<td><?php echo $dt_spdp['nm_kesatuan'] ?></td>
		</tr>
	</tbody>
</table>

<div class="da-panel-toolbar">
	<div class="btn-toolbar">
		<div class="btn-group">
		<?php 						
			$i = 1;
			while($dt=mysql_fetch_array($q_tersangka)) { 
				if($i==1) {$d=  true;} else {$d = "";}
		?>
			<a <?php tab_aktif($t,$dt['kd_tersangka'],PAGE_ID.'&p=bp&t='.$dt['kd_tersangka'],$d)?>><?php echo $tx_tersangka.$i ?></a>
		<?php $i++;} ?>
		</div>
	</div>
</div>

<table class="da-table da-detail-view no-border">
	<tbody>
	<tr>
		<th>Nama Lengkap</th>
		<td><?php echo $nama ?></td>
	</tr>
	<tr>
		<th>Tempat Lahir</th>
		<td><?php echo $tmp_lahir ?></td>
	</tr>
	<tr>
		<th>Tanggal Lahir / Umur</th>
		<td><?php echo $tgl_lahir ?> / <?php echo $umur ?> Tahun</td>
	</tr>
	<tr>
		<th>Jenis Kelamin</th>
		<td><?php if($jns_kelamin=='L'){
					echo 'Laki-Laki';
				  }else{
					echo 'Perempuan';
				  } ?></td>
	</tr>
	<tr>
		<th>Warga Negara</th>
		<td><?php echo $warganegara ?></td>
	</tr>
	<tr>
		<th>Tempat Tinggal</th>
		<td><?php echo $tmp_tinggal ?></td>
	</tr>
	<tr>
		<th>Agama</th>
		<td><?php echo $agama?></td>
	</tr>
	<tr>
		<th>Pekerjaan</th>
		<td><?php echo $pekerjaan ?></td>
	</tr>
	<tr>
		<th>Pendidikan</th>
		<td><?php echo $pendidikan ?></td>
	</tr>
	<tr>
		<th>Lain-lain</th>
		<td><?php echo $lain2 ?></td>
	</tr>
	</tbody>
</table>	

<div class="da-panel-toolbar">
	<div class="btn-toolbar">&nbsp;</div>
</div>

<table class="da-table da-detail-view no-border">
	<tbody>
		<tr>
			<th>Melanggar pasal</th>
			<td><?php echo $dt_spdp['melanggar_pasal']?></td>
		</tr>
		<tr>
			<th>Tanggal Penyidikan</th>
			<td>
				<?php if($dt_spdp['tgl_diterima'] != 0){
						echo konversi_tanggal('d-m-Y',$dt_spdp['tgl_diterima']);
					}else{
						echo "-";
					}
				?>
			</td>
		</tr>
		<tr>
			<th>Penyidik</th>
			<td><?php echo $dt_spdp['jns_pidana']?></td>
		</tr>
	</tbody>
</table>

<form id="da-form-spdp" class="da-form" method="post" action="modul/perkara/perkara.proses.php">
	<div class="da-form-inline">
		<div class="da-form-row">
			<label class="da-form-label">Nomor BP</label>
			<div class="da-form-item">
				<input type="text" value="<?php echo $no_bp ?>" name="no_bp">
			</div>
		</div>
		<div class="da-form-row">
			<label class="da-form-label">Tanggal dikeluarkan BP</label>
			<div class="da-form-item">
				<input id="da-tgl-bp-dikeluarkan" type="text" value="<?php echo $tgl_dikeluarkan ?>" name="tgl_dikeluarkan">
			</div>
		</div>
		<div class="da-form-row">
			<label class="da-form-label">Tanggal Diterima BP</label>
			<div class="da-form-item">
				<?php if(LEVEL=="jaksa" || LEVEL=="pratut") { 
					echo $tgl_diterima;
				} elseif(LEVEL=="sekretariat") { 
					if($tgl_diterima == "") {
						echo date("d-m-Y");
				?>
					<input type="hidden" value="<?php echo date("Y-m-d") ?>" name="tgl_diterima">
				<?php } else { 
						echo $tgl_diterima;?>
					<input type="hidden" value="<?php echo $tgl_diterima ?>" name="tgl_diterima">
				<?php } } elseif(LEVEL=="superadmin" || LEVEL=="admin") { ?>
				<input id="da-tgl-bp-diterima" type="text" value="<?php echo $tgl_diterima ?>" name="tgl_diterima">
				<?php } ?>
			</div>
		</div>
		<?php if($bp_ada) { ?>
		<!--div class="da-form-row">
			<label class="da-form-label">Sikap Jaksa P-16</label>
			<div class="da-form-item">
				
			</div>
		</div-->
		<?php } ?>
	</div>
	<div class="btn-row">
		<!--a href="#" class="btn"><i class="icol-calendar-2"></i> Riwayat Dokumen</a-->
		<?php if(LEVEL=="superadmin" || LEVEL=="admin" || LEVEL=="sekretariat" || LEVEL=="pratut"|| LEVEL=="jaksa" ) { ?>
		<button id="simpan-bp" class="btn"><i class="icol-disk"></i> Simpan</button>
		<?php }  ?>
		<input type="hidden" name="bp" value="simpan" />
		<input type="hidden" name="kd" value="<?php echo KD_PERKARA ?>" />
	</div>
</form>
